// const CryptoJS = require('crypto-js') // 引用AES源码js
import CryptoJS from 'crypto-js'
export function AES(str: string) {
  const key = CryptoJS.enc.Utf8.parse('1233455')
  const iv = CryptoJS.enc.Utf8.parse('223344')

  const encrypted = CryptoJS.AES.encrypt(str, key, {
    iv,
    mode: CryptoJS.mode.CBC,
    padding: CryptoJS.pad.Pkcs7
  })
  return CryptoJS.enc.Base64.stringify(encrypted.ciphertext) // Base64加密再 encode;
}
